package com.dongrj.framework.starter.sms;


import lombok.Getter;

@Getter
public enum SmsSceneEnum {
    Login(1, "登录"),
    Register(2, "注册"),
    Other(9999, "其他");

    private final int code;

    private final String desc;

    SmsSceneEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static SmsSceneEnum fromCode(int code) {
        for (SmsSceneEnum smsSceneEnum : values()) {
            if (smsSceneEnum.code == code) {
                return smsSceneEnum;
            }
        }
        return Other;
    }

}
